#ifndef D3D_APP_H
#define D3D_APP_H

#include <windows.h>
#include <windowsx.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <d3dx9tex.h>
#include "DXUT/DXUT.h"
#include "Singleton.h"


#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")


class D3DApp
{
public:
	~D3DApp();

	void Init(HWND hWnd);

	LPDIRECT3D9 GetD3D() const; 
	LPDIRECT3DDEVICE9 GetD3DDev() const;
	HWND GetWindowHandle() const;
	D3DVERTEXELEMENT9* GetVertexElements();
	void Clean();

	
		
private:
	D3DApp() {}

	LPDIRECT3D9 m_pD3D;
	LPDIRECT3DDEVICE9 m_pD3DDev;

	friend class Singleton<D3DApp>;
	D3DVERTEXELEMENT9 m_VertexElements[4];

};

typedef Singleton<D3DApp> TheD3DApp;

struct POSNORMUVVERTEX 
{
	D3DXVECTOR3 Pos;
	D3DXVECTOR3 Norm;
	D3DXVECTOR2 UV;
};

VOID WINAPI CF (D3DXVECTOR4* pOut, const D3DXVECTOR2* pTexCoord, 
	const D3DXVECTOR2* pTexelSize, LPVOID pData);

#endif